import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)
//静态路由
const routes = [
  //  登录页面
  {
    path: '/login',
    name: 'login',
    component: () => import(/* webpackChunkName: "login" */ '../views/auth/login.vue'),

  },
  //  主页菜单页
  {
    path: '/index',
    name: 'index',
    component: () => import(/* webpackChunkName: "login" */ '../views/index.vue'),
    children: [
        //起始主页
        {
            path: '/about',
            name: 'about',
          component: () => import(/* webpackChunkName: "login" */ '../views/AboutView.vue'),

        },
    ],

  },

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

router.selfaddRoutes = function (params) {
  router.matcher =  new VueRouter({mode: 'history'}).matcher
  router.addRoutes(params)
}


export default router
